<?php
    session_start();
	/**if(empty($_SESSION['adminmanager'])){
        header('Location:./backstage.php');
    }**/
    header('Content-type:text/html;charset=utf-8');
	
	function _strip_tags($tagsArr,$str) {   
	foreach ($tagsArr as $tag) {  
		$p[]="/(<(?:\/".$tag."|".$tag.")[^>]*>)/i";  
	}  
	$return_str = preg_replace($p,"",$str);  
	return $return_str;  
}  
	
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="../css/metinfo.css" />
<link rel="stylesheet" type="text/css" href="../css/list.css" />
<link rel="stylesheet" type="text/css" href="../css/common.css"/>
<script type="text/javascript" src="ckeditor/ckeditor.js"></script>

</head>

<style>
.yichu{width:50px;
overflow:hidden;
text-overflow:ellipsis;
white-space:nowrap;
}
</style>

<body>

	<div class="metinfotop">

	</div>
	<div class="clear"></div>


<div class="stat_list">
	<ul>
		<li class="now"><a href="1.html" title="基本信息">基本信息</a></li>
		<!--<li ><a href="1.html" title="系统邮箱配置">系统邮箱配置</a></li>-->
	</ul>
</div>
<div style="font-size:18px;color:#1f75b7;">&nbsp&nbsp&nbsp&nbsp管理管理员:</div>

 <form method="post" action="managerList.php">
<table border="0" align="center" >	
<tr align="left">
<td>查询管理员信息关键字&nbsp;</td>                          
<td ><input name="keyword" type="text"  style="height:25px; width:300px;">&nbsp;</td>                              
<td><input type="submit" name="Submit" value="搜索" style="height:25px; width:80px;"></td>
</tr>

</table>
<?php $keyword = $_POST['keyword']?>
<div>
	<table class="tablelist">
			<thead>
				<tr>
					<th>ID</th>
					<th>用户名</th>
					<th>密码</th>
					<th>操作</th>
				</tr>
			</thead>
			<?php
			
			
				//加载配置文件
				include '../config.php';
				$link = mysql_connect(HOST,DBUSER,DBPASS) or die('连接失败亲');
				mysql_select_db(DBNAME,$link);
				mysql_set_charset('utf8');
						//连接数据库计算共有多少页
						$sqls = "SELECT count(id) FROM t_manager WHERE name like '%$keyword%' order by id  desc";
						$results = mysql_query($sqls);
						if(!empty($results) && mysql_num_rows($results)>0){
							$rows = mysql_fetch_assoc($results);
							$alldata= $rows['count(id)'];
						}
						//当前页
						$page = empty($_GET['page']) ? 1 : $_GET['page'];
						if($page<0){
							$page = 1;
						}
						//每页有多少条数据
						$pageCount =12;
						//计算有多少页
						$allPage = ceil($alldata/$pageCount);
						
						//判断当前页数是否大于总页数
						if($page>$allPage){
							$page=$allPage;
						}				
				//sql
									
				$startPage = ($page-1)*$pageCount;
				$sql = "SELECT * FROM t_manager  WHERE  name like  '%$keyword%' order by id  desc LIMIT ".$startPage.",".$pageCount;
				$result = mysql_query($sql);
				if(!empty($result)&&mysql_num_rows($result)>0){
					while($rows = mysql_fetch_assoc($result)){
					
						echo'<tbody>
							<tr height="30px">
								<td>'.$rows['id'].'</td>
								<td>'.$rows['name'].'</td>
								<td>'.$rows['password'].'</td>
								<td width="125px">	
								    <a href="./managerSreach.php?id='.$rows['id'].'"><font color="#0000FF">查看及修改</font></a>
									|
									<a href="./managerDelete.php?id='.$rows['id'].'"><font color="#FF0000">删除</font></a>
								</td>
							</tr> 
						</tbody>';
					}
					
					
				}
				
				
				if(!empty($result)){
					mysql_free_result($result);					

					}else{
				}
				mysql_close($link);
				
				
				
			?>
				
		</table>
</div>
	   <?php
		echo '<div style="width:100%;height:40px;font-size:13px;line-height:40px;text-align:center;margin-top:18px;">';
						echo '<a href="./managerList.php?page=1">首页</a>';
						echo '<a href="./managerList.php?page='.($page-1).'">上一页</a>';
						echo '当前'.$page.'页/共'.$allPage.'页';
						echo '<a href="./managerList.php?page='.($page+1).'">下一页</a>';
						echo '<a href="./managerList.php?page='.$allPage.'">尾页</a>';
					echo '</div>';
		 
		 ?>
		
</body>
</html>